numBands = 32;
range = [0,22050];
normalization = "area";
designDomain = "linear";
fftLength= 1024;
fs=44.1e3;

[fb,cf,bw] = designAuditoryFilterBank(fs, ...
    "FrequencyScale","bark", ...
    "FFTLength",fftLength, ...
    "NumBands",numBands, ...
    "FrequencyRange",range, ...
    "Normalization",normalization, ...
    "FilterBankDesignDomain",designDomain);

numPoints = size(fb,2);
F=1:numPoints;
plot(F,fb.');
grid on
title("Bark Filter Bank")
xlabel("Frequency (Hz)")
writematrix(f,"stft-f1.txt")
writematrix(t,"stft-t1.txt")

format short
writematrix(fb,"bark-fbank-fb.txt",'delimiter','tab');
writematrix(cf,"bark-fbank-cf.txt",'delimiter','tab');
writematrix(bw,"bark-fbank-bw.txt",'delimiter','tab');